package com.music.biz.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.music.biz.AlbumBiz;
import com.music.dao.AlbumDao;
import com.music.entity.Album;

@Service("albumBiz")
public class AlbumBizImpl implements AlbumBiz {

	@Autowired
	private AlbumDao dao;
	
	@Transactional(propagation=Propagation.REQUIRED)
	public void add(Album album) {
		dao.add(album);
		
	}

	@Transactional(propagation=Propagation.REQUIRED)
	public void update(Album album) {
		dao.update(album);
		
	} 

	@Transactional(propagation=Propagation.REQUIRED)
	public void delete(int id) {
		dao.delete(id);
		
	}

	public Album fetchById(int id) {
		return dao.fetchById(id);
	}


	public List<Album> getHotAlbums(int num) {
		return dao.getHotAlbums(num);
	}


	public List<Album> getAlbumsByConditions(int id, int genreId, String title,
			int pageNo, int pageSize) {
		
		return dao.getAlbumsByConditions(id, genreId, title, pageNo, pageSize);
	}

	public int getRowCountByConditions(int id, int genreId, String title) {
		// TODO Auto-generated method stub
		return dao.getRowCountByConditions(id, genreId, title);
	}

	
}
